function Get-NewAzureDataFactoryName {
    Param (
        [Parameter(Mandatory = $false)][String[]]$Blocklist,
        [Parameter(Mandatory = $false)][string]$ADFv2Name,
        [Parameter(Mandatory = $false)][bool]$ConfirmAll = $false
    )
    
    # Allow user to use existing value or to update it.
    if ((Confirm-SingleValue -Description 'Azure Data Factory v2 name' -Value $ADFv2Name -ConfirmAll $ConfirmAll) -eq $true) { return $ADFv2Name }

    # Get regex from config file.
    $regex = (Read-Config).Regex.AzureDataFactoryV2 # Length: 3-63, Alphanumerics and hyphens. Start and end with alphanumeric.
    
    # Ask user for a new name.
    Write-Host # Newline.
    Write-Host 'Please provide a name for the new Azure Data Factory v2 resource. Use Alphanumerics and hyphens. Must start and end with an alphanumeric. Length is 3-63 characters.'
    do {
        $newName = Read-Host -Prompt "Azure Data Factory v2 name"
        if ($newName -iin $Blocklist) {
            $newName = $null
            Write-Warning 'Invalid name! The name you gave is already in use.'
        } elseif ($newName -cnotmatch $regex) {
            # Reset name if it doesn't match the regex.
            $newName = $null
            Write-Warning 'Invalid name! The name you gave had incorrect syntax.'
        }
    } while (!$newName)
    return $newName
}